<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "https://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" lang="zh">
<head>
<meta http-equiv="Content-Type" content="text/xhtml;charset=UTF-8"/>
<meta http-equiv="X-UA-Compatible" content="IE=11"/>
<meta name="generator" content="Doxygen 1.9.5"/>
<meta name="viewport" content="width=device-width, initial-scale=1"/>
<title>SWM34S_LVGL7.11_SWMUI: C:/Users/DELL/Desktop/Commit/lvgl/SWM34S_LVGL7.11_SWMUI_20230515/APP/Common Module/power_manager.c 源文件</title>
<link href="tabs.css" rel="stylesheet" type="text/css"/>
<script type="text/javascript" src="jquery.js"></script>
<script type="text/javascript" src="dynsections.js"></script>
<link href="doxygen.css" rel="stylesheet" type="text/css" />
</head>
<body>
<div id="top"><!-- do not remove this div, it is closed by doxygen! -->
<div id="titlearea">
<table cellspacing="0" cellpadding="0">
 <tbody>
 <tr id="projectrow">
  <td id="projectalign">
   <div id="projectname">SWM34S_LVGL7.11_SWMUI<span id="projectnumber">&#160;V7.9</span>
   </div>
  </td>
 </tr>
 </tbody>
</table>
</div>
<!-- end header part -->
<!-- 制作者 Doxygen 1.9.5 -->
<div id="nav-path" class="navpath">
  <ul>
<li class="navelem"><a class="el" href="dir_0ca16891106f5a3e9ad635a0d6c5f98f.html">APP</a></li><li class="navelem"><a class="el" href="dir_df4e0e4e72f77ab290fd1a24f190250a.html">Common Module</a></li>  </ul>
</div>
</div><!-- top -->
<div class="header">
  <div class="headertitle"><div class="title">power_manager.c</div></div>
</div><!--header-->
<div class="contents">
<a href="power__manager_8c.html">浏览该文件的文档.</a><div class="fragment"><div class="line"><a id="l00001" name="l00001"></a><span class="lineno">    1</span> </div>
<div class="line"><a id="l00022" name="l00022"></a><span class="lineno">   22</span><span class="preprocessor">#include &quot;<a class="code" href="version_8h.html">version.h</a>&quot;</span></div>
<div class="line"><a id="l00023" name="l00023"></a><span class="lineno">   23</span><span class="preprocessor">#include &quot;<a class="code" href="bsp__init_8h.html">bsp_init.h</a>&quot;</span></div>
<div class="line"><a id="l00024" name="l00024"></a><span class="lineno">   24</span><span class="preprocessor">#include &quot;<a class="code" href="power__manager_8h.html">power_manager.h</a>&quot;</span></div>
<div class="line"><a id="l00025" name="l00025"></a><span class="lineno">   25</span> </div>
<div class="line"><a id="l00026" name="l00026"></a><span class="lineno">   26</span><span class="comment">/*******************************************************************************************************************************************</span></div>
<div class="line"><a id="l00027" name="l00027"></a><span class="lineno">   27</span><span class="comment"> * Private Define</span></div>
<div class="line"><a id="l00028" name="l00028"></a><span class="lineno">   28</span><span class="comment"> *******************************************************************************************************************************************/</span></div>
<div class="line"><a id="l00029" name="l00029"></a><span class="lineno">   29</span><span class="comment">//#define PM_DEBUG_ENABLE /**&lt; 模块调试日志输出使能宏 */</span></div>
<div class="line"><a id="l00030" name="l00030"></a><span class="lineno">   30</span> </div>
<div class="line"><a id="l00032" name="l00032"></a><span class="lineno">   32</span><span class="preprocessor">#ifdef PM_DEBUG_ENABLE</span></div>
<div class="line"><a id="l00033" name="l00033"></a><span class="lineno">   33</span><span class="preprocessor">    #define PM_LOG(...)                 printf(__VA_ARGS__)</span></div>
<div class="line"><a id="l00034" name="l00034"></a><span class="lineno">   34</span><span class="preprocessor">#else</span></div>
<div class="line"><a id="l00035" name="l00035"></a><span class="lineno"><a class="line" href="power__manager_8c.html#aec9b8b25cdba2b2a4db7ea6e200e1662">   35</a></span><span class="preprocessor">    #define PM_LOG(...)</span></div>
<div class="line"><a id="l00036" name="l00036"></a><span class="lineno">   36</span><span class="preprocessor">#endif</span></div>
<div class="line"><a id="l00037" name="l00037"></a><span class="lineno">   37</span> </div>
<div class="line"><a id="l00038" name="l00038"></a><span class="lineno">   38</span><span class="comment">/*******************************************************************************************************************************************</span></div>
<div class="line"><a id="l00039" name="l00039"></a><span class="lineno">   39</span><span class="comment"> * Private Prototype</span></div>
<div class="line"><a id="l00040" name="l00040"></a><span class="lineno">   40</span><span class="comment"> *******************************************************************************************************************************************/</span></div>
<div class="line"><a id="l00045" name="l00045"></a><span class="lineno">   45</span><span class="keyword">static</span> <span class="keywordtype">void</span> <a class="code hl_function" href="power__manager_8c.html#ab9c5028de96a56cb56cd352d70cf1b87">sleep_request_clean</a>(<span class="keywordtype">void</span>);</div>
<div class="line"><a id="l00046" name="l00046"></a><span class="lineno">   46</span> </div>
<div class="line"><a id="l00051" name="l00051"></a><span class="lineno">   51</span><span class="keyword">static</span> <span class="keywordtype">void</span> <a class="code hl_function" href="power__manager_8c.html#a0607f7307b006db734b10c8b94bb909e">sleep_resume_restore</a>(<span class="keywordtype">void</span>);</div>
<div class="line"><a id="l00052" name="l00052"></a><span class="lineno">   52</span> </div>
<div class="line"><a id="l00053" name="l00053"></a><span class="lineno">   53</span><span class="comment">/*******************************************************************************************************************************************</span></div>
<div class="line"><a id="l00054" name="l00054"></a><span class="lineno">   54</span><span class="comment"> * Private Variable</span></div>
<div class="line"><a id="l00055" name="l00055"></a><span class="lineno">   55</span><span class="comment"> *******************************************************************************************************************************************/</span></div>
<div class="line"><a id="l00056" name="l00056"></a><span class="lineno"><a class="line" href="power__manager_8c.html#a3c4c6eea77c2517d9b66ac4f6d335d71">   56</a></span><span class="keyword">static</span> void (*<span class="keyword">volatile</span> <a class="code hl_variable" href="power__manager_8c.html#a3c4c6eea77c2517d9b66ac4f6d335d71">sleep_request_cb</a>)(void) = <a class="code hl_function" href="power__manager_8c.html#ab9c5028de96a56cb56cd352d70cf1b87">sleep_request_clean</a>;</div>
<div class="line"><a id="l00057" name="l00057"></a><span class="lineno"><a class="line" href="power__manager_8c.html#abbef8fc57314a19ea86ee1b3f1613a49">   57</a></span><span class="keyword">static</span> void (*<span class="keyword">volatile</span> <a class="code hl_variable" href="power__manager_8c.html#abbef8fc57314a19ea86ee1b3f1613a49">sleep_resume_cb</a>)(void) = <a class="code hl_function" href="power__manager_8c.html#a0607f7307b006db734b10c8b94bb909e">sleep_resume_restore</a>;</div>
<div class="line"><a id="l00058" name="l00058"></a><span class="lineno">   58</span> </div>
<div class="line"><a id="l00059" name="l00059"></a><span class="lineno">   59</span><span class="comment">/*******************************************************************************************************************************************</span></div>
<div class="line"><a id="l00060" name="l00060"></a><span class="lineno">   60</span><span class="comment"> * Public Function</span></div>
<div class="line"><a id="l00061" name="l00061"></a><span class="lineno">   61</span><span class="comment"> *******************************************************************************************************************************************/</span></div>
<div class="line"><a id="l00067" name="l00067"></a><span class="lineno"><a class="line" href="power__manager_8c.html#aa125d952f6750a2c86b46ecfc611b399">   67</a></span><span class="keywordtype">void</span> <a class="code hl_function" href="power__manager_8c.html#aa125d952f6750a2c86b46ecfc611b399">pm_request</a>(<a class="code hl_enumeration" href="power__manager_8h.html#ad68f0f1a7d5e0cc311f261c21716f8c1">pm_mode_t</a> mode)</div>
<div class="line"><a id="l00068" name="l00068"></a><span class="lineno">   68</span>{</div>
<div class="line"><a id="l00069" name="l00069"></a><span class="lineno">   69</span>    <span class="keywordflow">switch</span> (mode)</div>
<div class="line"><a id="l00070" name="l00070"></a><span class="lineno">   70</span>    {</div>
<div class="line"><a id="l00071" name="l00071"></a><span class="lineno">   71</span>        <span class="keywordflow">case</span> (<a class="code hl_enumvalue" href="power__manager_8h.html#ad68f0f1a7d5e0cc311f261c21716f8c1aeb339438b5c866323b92ac8f8c71564c">PM_MODE_NORMAL</a>) : </div>
<div class="line"><a id="l00072" name="l00072"></a><span class="lineno">   72</span>            </div>
<div class="line"><a id="l00073" name="l00073"></a><span class="lineno">   73</span>        <span class="keywordflow">break</span>;</div>
<div class="line"><a id="l00074" name="l00074"></a><span class="lineno">   74</span>        </div>
<div class="line"><a id="l00075" name="l00075"></a><span class="lineno">   75</span>        <span class="keywordflow">case</span> (<a class="code hl_enumvalue" href="power__manager_8h.html#ad68f0f1a7d5e0cc311f261c21716f8c1a7f72cb1eff8d0a943b7029b3e93c4e67">PM_MODE_SLEEP</a>) : </div>
<div class="line"><a id="l00076" name="l00076"></a><span class="lineno">   76</span>            <a class="code hl_variable" href="power__manager_8c.html#a3c4c6eea77c2517d9b66ac4f6d335d71">sleep_request_cb</a>();</div>
<div class="line"><a id="l00077" name="l00077"></a><span class="lineno">   77</span>            <a class="code hl_function" href="dev__sleep__stop_8c.html#a4d4c631bc1d45f13302e7f874c8337eb">sleep_init</a>();</div>
<div class="line"><a id="l00078" name="l00078"></a><span class="lineno">   78</span>            <a class="code hl_variable" href="power__manager_8c.html#abbef8fc57314a19ea86ee1b3f1613a49">sleep_resume_cb</a>();</div>
<div class="line"><a id="l00079" name="l00079"></a><span class="lineno">   79</span>        <span class="keywordflow">break</span>;</div>
<div class="line"><a id="l00080" name="l00080"></a><span class="lineno">   80</span>        </div>
<div class="line"><a id="l00081" name="l00081"></a><span class="lineno">   81</span>        <span class="keywordflow">case</span> (<a class="code hl_enumvalue" href="power__manager_8h.html#ad68f0f1a7d5e0cc311f261c21716f8c1a0558d994d2c989e32c28ba7be299c026">PM_MODE_STOP</a>) : </div>
<div class="line"><a id="l00082" name="l00082"></a><span class="lineno">   82</span>            <a class="code hl_function" href="dev__sleep__stop_8c.html#a5b06de9b1a4503a9890c7ae85f041c58">stop_init</a>();</div>
<div class="line"><a id="l00083" name="l00083"></a><span class="lineno">   83</span>        <span class="keywordflow">break</span>;</div>
<div class="line"><a id="l00084" name="l00084"></a><span class="lineno">   84</span>        </div>
<div class="line"><a id="l00085" name="l00085"></a><span class="lineno">   85</span>        default : <span class="keywordflow">break</span>;</div>
<div class="line"><a id="l00086" name="l00086"></a><span class="lineno">   86</span>    }</div>
<div class="line"><a id="l00087" name="l00087"></a><span class="lineno">   87</span>}</div>
<div class="line"><a id="l00088" name="l00088"></a><span class="lineno">   88</span> </div>
<div class="line"><a id="l00097" name="l00097"></a><span class="lineno"><a class="line" href="power__manager_8c.html#a07250972b4737e676c66368d6b55a53f">   97</a></span><span class="keywordtype">void</span> <a class="code hl_function" href="power__manager_8c.html#a07250972b4737e676c66368d6b55a53f">pm_register</a>(<a class="code hl_enumeration" href="power__manager_8h.html#ad68f0f1a7d5e0cc311f261c21716f8c1">pm_mode_t</a> mode, <span class="keywordtype">void</span> (*request_cb)(<span class="keywordtype">void</span>), <span class="keywordtype">void</span> (*resume_cb)(<span class="keywordtype">void</span>))</div>
<div class="line"><a id="l00098" name="l00098"></a><span class="lineno">   98</span>{</div>
<div class="line"><a id="l00099" name="l00099"></a><span class="lineno">   99</span>    <span class="keywordflow">switch</span> (mode)</div>
<div class="line"><a id="l00100" name="l00100"></a><span class="lineno">  100</span>    {</div>
<div class="line"><a id="l00101" name="l00101"></a><span class="lineno">  101</span>        <span class="keywordflow">case</span> (<a class="code hl_enumvalue" href="power__manager_8h.html#ad68f0f1a7d5e0cc311f261c21716f8c1aeb339438b5c866323b92ac8f8c71564c">PM_MODE_NORMAL</a>) : <span class="keywordflow">break</span>;</div>
<div class="line"><a id="l00102" name="l00102"></a><span class="lineno">  102</span>        </div>
<div class="line"><a id="l00103" name="l00103"></a><span class="lineno">  103</span>        <span class="keywordflow">case</span> (<a class="code hl_enumvalue" href="power__manager_8h.html#ad68f0f1a7d5e0cc311f261c21716f8c1a7f72cb1eff8d0a943b7029b3e93c4e67">PM_MODE_SLEEP</a>) : </div>
<div class="line"><a id="l00104" name="l00104"></a><span class="lineno">  104</span>            <a class="code hl_variable" href="power__manager_8c.html#a3c4c6eea77c2517d9b66ac4f6d335d71">sleep_request_cb</a> = request_cb;</div>
<div class="line"><a id="l00105" name="l00105"></a><span class="lineno">  105</span>            <a class="code hl_variable" href="power__manager_8c.html#abbef8fc57314a19ea86ee1b3f1613a49">sleep_resume_cb</a> = resume_cb;</div>
<div class="line"><a id="l00106" name="l00106"></a><span class="lineno">  106</span>        <span class="keywordflow">break</span>;</div>
<div class="line"><a id="l00107" name="l00107"></a><span class="lineno">  107</span>        </div>
<div class="line"><a id="l00108" name="l00108"></a><span class="lineno">  108</span>        <span class="keywordflow">case</span> (<a class="code hl_enumvalue" href="power__manager_8h.html#ad68f0f1a7d5e0cc311f261c21716f8c1a0558d994d2c989e32c28ba7be299c026">PM_MODE_STOP</a>) : <span class="keywordflow">break</span>;</div>
<div class="line"><a id="l00109" name="l00109"></a><span class="lineno">  109</span>            <span class="comment">/* TODO */</span></div>
<div class="line"><a id="l00110" name="l00110"></a><span class="lineno">  110</span>        default : <span class="keywordflow">break</span>;</div>
<div class="line"><a id="l00111" name="l00111"></a><span class="lineno">  111</span>    }</div>
<div class="line"><a id="l00112" name="l00112"></a><span class="lineno">  112</span>}</div>
<div class="line"><a id="l00113" name="l00113"></a><span class="lineno">  113</span> </div>
<div class="line"><a id="l00114" name="l00114"></a><span class="lineno">  114</span><span class="comment">/*******************************************************************************************************************************************</span></div>
<div class="line"><a id="l00115" name="l00115"></a><span class="lineno">  115</span><span class="comment"> * Private Function</span></div>
<div class="line"><a id="l00116" name="l00116"></a><span class="lineno">  116</span><span class="comment"> *******************************************************************************************************************************************/</span></div>
<div class="line"><a id="l00121" name="l00121"></a><span class="lineno"><a class="line" href="power__manager_8c.html#ab9c5028de96a56cb56cd352d70cf1b87">  121</a></span><span class="keyword">static</span> <span class="keywordtype">void</span> <a class="code hl_function" href="power__manager_8c.html#ab9c5028de96a56cb56cd352d70cf1b87">sleep_request_clean</a>(<span class="keywordtype">void</span>)</div>
<div class="line"><a id="l00122" name="l00122"></a><span class="lineno">  122</span>{</div>
<div class="line"><a id="l00123" name="l00123"></a><span class="lineno">  123</span>    <span class="comment">/* 关掉 DAC */</span></div>
<div class="line"><a id="l00124" name="l00124"></a><span class="lineno">  124</span>    <span class="comment">//dac_dma_deinit();</span></div>
<div class="line"><a id="l00125" name="l00125"></a><span class="lineno">  125</span>    <a class="code hl_function" href="dev__dac_8c.html#ae6564f4952cc109138c86b644e9585d9">dac_port_deinit</a>();</div>
<div class="line"><a id="l00126" name="l00126"></a><span class="lineno">  126</span> </div>
<div class="line"><a id="l00127" name="l00127"></a><span class="lineno">  127</span>    <span class="comment">/* 关掉 TP  */</span></div>
<div class="line"><a id="l00128" name="l00128"></a><span class="lineno">  128</span>    <a class="code hl_variable" href="dev__touch_8c.html#a84c114ba14f4f7ca7c2258db06b98d87">Dev_TP</a>.<a class="code hl_variable" href="structdev__tp__t.html#a90323c876c50bbbc15dce886974a463f">close_cb</a>();</div>
<div class="line"><a id="l00129" name="l00129"></a><span class="lineno">  129</span> </div>
<div class="line"><a id="l00130" name="l00130"></a><span class="lineno">  130</span>    <span class="comment">/* 关掉 LCD */</span></div>
<div class="line"><a id="l00131" name="l00131"></a><span class="lineno">  131</span><span class="preprocessor">#if 1 </span><span class="comment">/* 0 : MPU/MCU接口  1 : RGB 接口 */</span><span class="preprocessor"></span></div>
<div class="line"><a id="l00132" name="l00132"></a><span class="lineno">  132</span>    <span class="keywordflow">if</span> (LCD-&gt;CR &amp; LCD_CR_AUTORESTA_Msk) <span class="comment">/* 若不使用 LCD 中断, 则需要关闭 LCD 自动传输 */</span></div>
<div class="line"><a id="l00133" name="l00133"></a><span class="lineno">  133</span>    {</div>
<div class="line"><a id="l00134" name="l00134"></a><span class="lineno">  134</span>        LCD-&gt;CR &amp;= ~LCD_CR_AUTORESTA_Msk;</div>
<div class="line"><a id="l00135" name="l00135"></a><span class="lineno">  135</span>    }</div>
<div class="line"><a id="l00136" name="l00136"></a><span class="lineno">  136</span>    <span class="keywordflow">else</span></div>
<div class="line"><a id="l00137" name="l00137"></a><span class="lineno">  137</span>    {</div>
<div class="line"><a id="l00138" name="l00138"></a><span class="lineno">  138</span>        LCD_INTDis(LCD);</div>
<div class="line"><a id="l00139" name="l00139"></a><span class="lineno">  139</span>        LCD_INTClr(LCD);</div>
<div class="line"><a id="l00140" name="l00140"></a><span class="lineno">  140</span>    }</div>
<div class="line"><a id="l00141" name="l00141"></a><span class="lineno">  141</span>    <span class="keywordflow">while</span> (LCD_IsBusy(LCD))</div>
<div class="line"><a id="l00142" name="l00142"></a><span class="lineno">  142</span>        __NOP(); <span class="comment">/* 等待 LCD 刷完休眠前最后一帧图像后再关闭 SDRAM */</span></div>
<div class="line"><a id="l00143" name="l00143"></a><span class="lineno">  143</span><span class="preprocessor">#else </span></div>
<div class="line"><a id="l00144" name="l00144"></a><span class="lineno">  144</span>    <span class="keywordflow">while</span> (LCD_IsBusy(LCD))</div>
<div class="line"><a id="l00145" name="l00145"></a><span class="lineno">  145</span>        __NOP(); <span class="comment">/* 等待 LCD 刷完休眠前最后一帧图像后再关闭 SDRAM */</span></div>
<div class="line"><a id="l00146" name="l00146"></a><span class="lineno">  146</span>    LCD_INTDis(LCD);</div>
<div class="line"><a id="l00147" name="l00147"></a><span class="lineno">  147</span>    LCD_INTClr(LCD);</div>
<div class="line"><a id="l00148" name="l00148"></a><span class="lineno">  148</span>    <span class="comment">//Dev_LCD.close();</span></div>
<div class="line"><a id="l00149" name="l00149"></a><span class="lineno">  149</span><span class="preprocessor">#endif</span></div>
<div class="line"><a id="l00150" name="l00150"></a><span class="lineno">  150</span> </div>
<div class="line"><a id="l00151" name="l00151"></a><span class="lineno">  151</span>    <span class="comment">/* 失能 SDRAM, 进入低功耗模式, 自刷新不可读写 */</span></div>
<div class="line"><a id="l00152" name="l00152"></a><span class="lineno">  152</span>    SDRAM_Disable();</div>
<div class="line"><a id="l00153" name="l00153"></a><span class="lineno">  153</span>    <span class="comment">// PORTM-&gt;PULLD |= (1 &lt;&lt; PIN14); /* 下拉 M14, 使内部 SDRAM CKE 信号拉低, 进入 PD 状态 */</span></div>
<div class="line"><a id="l00154" name="l00154"></a><span class="lineno">  154</span>}</div>
<div class="line"><a id="l00155" name="l00155"></a><span class="lineno">  155</span> </div>
<div class="line"><a id="l00160" name="l00160"></a><span class="lineno"><a class="line" href="power__manager_8c.html#a0607f7307b006db734b10c8b94bb909e">  160</a></span><span class="keyword">static</span> <span class="keywordtype">void</span> <a class="code hl_function" href="power__manager_8c.html#a0607f7307b006db734b10c8b94bb909e">sleep_resume_restore</a>(<span class="keywordtype">void</span>)</div>
<div class="line"><a id="l00161" name="l00161"></a><span class="lineno">  161</span>{</div>
<div class="line"><a id="l00162" name="l00162"></a><span class="lineno">  162</span>    <span class="comment">/* 如要恢复 SWD 端口功能必须加上这句, 未在固件库中开放给用户 */</span></div>
<div class="line"><a id="l00163" name="l00163"></a><span class="lineno">  163</span>    *((<span class="keyword">volatile</span> uint32_t *)0x40000190) = 1;</div>
<div class="line"><a id="l00164" name="l00164"></a><span class="lineno">  164</span>    PORT_Init(PORTB, PIN14, PORTB_PIN14_SWDIO, 1);</div>
<div class="line"><a id="l00165" name="l00165"></a><span class="lineno">  165</span>    PORT_Init(PORTB, PIN12, PORTB_PIN12_SWDCK, 1);</div>
<div class="line"><a id="l00166" name="l00166"></a><span class="lineno">  166</span> </div>
<div class="line"><a id="l00167" name="l00167"></a><span class="lineno">  167</span>    <span class="comment">/* 配置内部 SDRAM 叠封 &lt;未引出&gt; 的端口 */</span></div>
<div class="line"><a id="l00168" name="l00168"></a><span class="lineno">  168</span>    <a class="code hl_function" href="dev__sdram_8c.html#a1ca4fa8f2864c10eb1fe5f8b59bc121d">sdram_port_init</a>();</div>
<div class="line"><a id="l00169" name="l00169"></a><span class="lineno">  169</span> </div>
<div class="line"><a id="l00170" name="l00170"></a><span class="lineno">  170</span>    <span class="comment">/* 使能 SDRAM, 恢复可读写 */</span></div>
<div class="line"><a id="l00171" name="l00171"></a><span class="lineno">  171</span>    SDRAM_Enable();</div>
<div class="line"><a id="l00172" name="l00172"></a><span class="lineno">  172</span>    <span class="comment">// PORTM-&gt;PULLD &amp;= ~(1 &lt;&lt; PIN14); /* 取消下拉 M14, 恢复内部 SDRAM CKE 信号, 退出 PD 状态 */</span></div>
<div class="line"><a id="l00173" name="l00173"></a><span class="lineno">  173</span> </div>
<div class="line"><a id="l00174" name="l00174"></a><span class="lineno">  174</span>    <span class="comment">/* 有涉及到端口的外设都需要重新配置以恢复状态 */</span></div>
<div class="line"><a id="l00175" name="l00175"></a><span class="lineno">  175</span>    <a class="code hl_function" href="dev__uart_8c.html#aadbe4996756dcc6199bc9ec2e4969993">uart_debug_port_init</a>();</div>
<div class="line"><a id="l00176" name="l00176"></a><span class="lineno">  176</span>    <a class="code hl_function" href="dev__sfc_8c.html#a3e07babe174017b09f2d82c4951172c8">sfc_port_init</a>();</div>
<div class="line"><a id="l00177" name="l00177"></a><span class="lineno">  177</span>    <a class="code hl_function" href="dev__touch_8c.html#ad79fb3af238f076a0aa90e32a43ab77e">touch_init</a>(&amp;<a class="code hl_variable" href="dev__touch_8c.html#a84c114ba14f4f7ca7c2258db06b98d87">Dev_TP</a>);</div>
<div class="line"><a id="l00178" name="l00178"></a><span class="lineno">  178</span>    </div>
<div class="line"><a id="l00179" name="l00179"></a><span class="lineno">  179</span>    <a class="code hl_function" href="dev__dac_8c.html#aab3eb615ca98a910e727b600de131c18">dac_port_init</a>();</div>
<div class="line"><a id="l00180" name="l00180"></a><span class="lineno">  180</span>    <span class="comment">//TIMR_Resume(TIMR0); // 恢复触发源</span></div>
<div class="line"><a id="l00181" name="l00181"></a><span class="lineno">  181</span> </div>
<div class="line"><a id="l00182" name="l00182"></a><span class="lineno">  182</span><span class="preprocessor">#if 1 </span><span class="comment">/* 0 : MPU/MCU接口  1 : RGB 接口 */</span><span class="preprocessor"></span></div>
<div class="line"><a id="l00183" name="l00183"></a><span class="lineno">  183</span>    <a class="code hl_function" href="dev__lcd_8c.html#a12e086c686f4e114e18e768751447d51">lcd_port_init</a>();</div>
<div class="line"><a id="l00184" name="l00184"></a><span class="lineno">  184</span>    <span class="comment">/* 背光 */</span></div>
<div class="line"><a id="l00185" name="l00185"></a><span class="lineno">  185</span>    <a class="code hl_function" href="dev__lcd_8c.html#ae4ceaa98ea8b4df351fe6a6fb0ad648b">lcd_set_bg_light</a>(100);</div>
<div class="line"><a id="l00186" name="l00186"></a><span class="lineno">  186</span>    </div>
<div class="line"><a id="l00187" name="l00187"></a><span class="lineno">  187</span>    <span class="comment">/* 使能 LCD, 注意 : 此时 SDRAM 的显存数据保持为休眠前的</span></div>
<div class="line"><a id="l00188" name="l00188"></a><span class="lineno">  188</span><span class="comment">     * 1-失能传输完成中断, 刷完一帧自动开始刷新下一帧</span></div>
<div class="line"><a id="l00189" name="l00189"></a><span class="lineno">  189</span><span class="comment">     * 0-使能传输完成中断, 须在中断内软件启动刷新下一帧</span></div>
<div class="line"><a id="l00190" name="l00190"></a><span class="lineno">  190</span><span class="comment">     */</span></div>
<div class="line"><a id="l00191" name="l00191"></a><span class="lineno">  191</span><span class="preprocessor">    #if 1</span></div>
<div class="line"><a id="l00192" name="l00192"></a><span class="lineno">  192</span>    <span class="comment">/* 若不使用 LCD 中断, 则需要在开启 LCD 自动传输 前 保持 GO 位被置位 */</span></div>
<div class="line"><a id="l00193" name="l00193"></a><span class="lineno">  193</span>    LCD_Start(LCD);</div>
<div class="line"><a id="l00194" name="l00194"></a><span class="lineno">  194</span>    LCD-&gt;CR |= LCD_CR_AUTORESTA_Msk;</div>
<div class="line"><a id="l00195" name="l00195"></a><span class="lineno">  195</span><span class="preprocessor">    #else</span></div>
<div class="line"><a id="l00196" name="l00196"></a><span class="lineno">  196</span>    LCD_INTEn(LCD);</div>
<div class="line"><a id="l00197" name="l00197"></a><span class="lineno">  197</span>    NVIC_EnableIRQ(LCD_IRQn);</div>
<div class="line"><a id="l00198" name="l00198"></a><span class="lineno">  198</span>    LCD_Start(LCD);</div>
<div class="line"><a id="l00199" name="l00199"></a><span class="lineno">  199</span><span class="preprocessor">    #endif</span></div>
<div class="line"><a id="l00200" name="l00200"></a><span class="lineno">  200</span> </div>
<div class="line"><a id="l00201" name="l00201"></a><span class="lineno">  201</span><span class="preprocessor">#else </span></div>
<div class="line"><a id="l00202" name="l00202"></a><span class="lineno">  202</span>    <span class="comment">/* 配置 LCD 端口 */</span></div>
<div class="line"><a id="l00203" name="l00203"></a><span class="lineno">  203</span>    Dev_LCD.port_init();</div>
<div class="line"><a id="l00204" name="l00204"></a><span class="lineno">  204</span>    <span class="comment">/* 恢复背光 */</span></div>
<div class="line"><a id="l00205" name="l00205"></a><span class="lineno">  205</span>    Dev_LCD.set_brightness(1);</div>
<div class="line"><a id="l00206" name="l00206"></a><span class="lineno">  206</span><span class="preprocessor">#endif</span></div>
<div class="line"><a id="l00207" name="l00207"></a><span class="lineno">  207</span> </div>
<div class="line"><a id="l00208" name="l00208"></a><span class="lineno">  208</span>    <span class="comment">/* 打开 USB */</span></div>
<div class="line"><a id="l00209" name="l00209"></a><span class="lineno">  209</span>    <span class="comment">/* TODO: 根据应用层需求来初始化配置为具体的 USB 设备类 */</span></div>
<div class="line"><a id="l00210" name="l00210"></a><span class="lineno">  210</span>}</div>
<div class="line"><a id="l00211" name="l00211"></a><span class="lineno">  211</span> </div>
<div class="ttc" id="absp__init_8h_html"><div class="ttname"><a href="bsp__init_8h.html">bsp_init.h</a></div><div class="ttdoc">板级硬件外设初始化</div></div>
<div class="ttc" id="adev__dac_8c_html_aab3eb615ca98a910e727b600de131c18"><div class="ttname"><a href="dev__dac_8c.html#aab3eb615ca98a910e727b600de131c18">dac_port_init</a></div><div class="ttdeci">void dac_port_init(void)</div><div class="ttdoc">配置 DAC 驱动端口以及功放静音控制脚, 开启声音</div><div class="ttdef"><b>Definition:</b> <a href="dev__dac_8c_source.html#l00119">dev_dac.c:119</a></div></div>
<div class="ttc" id="adev__dac_8c_html_ae6564f4952cc109138c86b644e9585d9"><div class="ttname"><a href="dev__dac_8c.html#ae6564f4952cc109138c86b644e9585d9">dac_port_deinit</a></div><div class="ttdeci">void dac_port_deinit(void)</div><div class="ttdoc">恢复 DAC 驱动端口以及功放静音控制脚的默认状态, 使能静音</div><div class="ttdef"><b>Definition:</b> <a href="dev__dac_8c_source.html#l00133">dev_dac.c:133</a></div></div>
<div class="ttc" id="adev__lcd_8c_html_a12e086c686f4e114e18e768751447d51"><div class="ttname"><a href="dev__lcd_8c.html#a12e086c686f4e114e18e768751447d51">lcd_port_init</a></div><div class="ttdeci">void lcd_port_init(void)</div><div class="ttdoc">初始化 LCD 驱动端口</div><div class="ttdef"><b>Definition:</b> <a href="dev__lcd_8c_source.html#l00127">dev_lcd.c:127</a></div></div>
<div class="ttc" id="adev__lcd_8c_html_ae4ceaa98ea8b4df351fe6a6fb0ad648b"><div class="ttname"><a href="dev__lcd_8c.html#ae4ceaa98ea8b4df351fe6a6fb0ad648b">lcd_set_bg_light</a></div><div class="ttdeci">void lcd_set_bg_light(uint8_t percentage)</div><div class="ttdoc">LCD 背光亮度调节</div><div class="ttdef"><b>Definition:</b> <a href="dev__lcd_8c_source.html#l00163">dev_lcd.c:163</a></div></div>
<div class="ttc" id="adev__sdram_8c_html_a1ca4fa8f2864c10eb1fe5f8b59bc121d"><div class="ttname"><a href="dev__sdram_8c.html#a1ca4fa8f2864c10eb1fe5f8b59bc121d">sdram_port_init</a></div><div class="ttdeci">void sdram_port_init(void)</div><div class="ttdoc">配置芯片内置的 SDRAM 驱动端口</div><div class="ttdef"><b>Definition:</b> <a href="dev__sdram_8c_source.html#l00060">dev_sdram.c:60</a></div></div>
<div class="ttc" id="adev__sfc_8c_html_a3e07babe174017b09f2d82c4951172c8"><div class="ttname"><a href="dev__sfc_8c.html#a3e07babe174017b09f2d82c4951172c8">sfc_port_init</a></div><div class="ttdeci">void sfc_port_init(void)</div><div class="ttdoc">配置 SFC 专用驱动端口</div><div class="ttdef"><b>Definition:</b> <a href="dev__sfc_8c_source.html#l00045">dev_sfc.c:45</a></div></div>
<div class="ttc" id="adev__sleep__stop_8c_html_a4d4c631bc1d45f13302e7f874c8337eb"><div class="ttname"><a href="dev__sleep__stop_8c.html#a4d4c631bc1d45f13302e7f874c8337eb">sleep_init</a></div><div class="ttdeci">void sleep_init(void)</div><div class="ttdoc">进入浅睡眠模式, 被唤醒后会退出该函数恢复程序继续执行, 外设工作状态以及 RAM 数据将会保持.</div><div class="ttdef"><b>Definition:</b> <a href="dev__sleep__stop_8c_source.html#l00090">dev_sleep_stop.c:90</a></div></div>
<div class="ttc" id="adev__sleep__stop_8c_html_a5b06de9b1a4503a9890c7ae85f041c58"><div class="ttname"><a href="dev__sleep__stop_8c.html#a5b06de9b1a4503a9890c7ae85f041c58">stop_init</a></div><div class="ttdeci">void stop_init(void)</div><div class="ttdoc">进入停止模式, 芯片完全停止工作</div><div class="ttdef"><b>Definition:</b> <a href="dev__sleep__stop_8c_source.html#l00068">dev_sleep_stop.c:68</a></div></div>
<div class="ttc" id="adev__touch_8c_html_a84c114ba14f4f7ca7c2258db06b98d87"><div class="ttname"><a href="dev__touch_8c.html#a84c114ba14f4f7ca7c2258db06b98d87">Dev_TP</a></div><div class="ttdeci">dev_tp_t Dev_TP</div><div class="ttdoc">触摸屏设备</div><div class="ttdef"><b>Definition:</b> <a href="dev__touch_8c_source.html#l00073">dev_touch.c:73</a></div></div>
<div class="ttc" id="adev__touch_8c_html_ad79fb3af238f076a0aa90e32a43ab77e"><div class="ttname"><a href="dev__touch_8c.html#ad79fb3af238f076a0aa90e32a43ab77e">touch_init</a></div><div class="ttdeci">uint8_t touch_init(dev_tp_t *dev)</div><div class="ttdoc">初始化触摸设备驱动</div><div class="ttdef"><b>Definition:</b> <a href="dev__touch_8c_source.html#l00140">dev_touch.c:140</a></div></div>
<div class="ttc" id="adev__uart_8c_html_aadbe4996756dcc6199bc9ec2e4969993"><div class="ttname"><a href="dev__uart_8c.html#aadbe4996756dcc6199bc9ec2e4969993">uart_debug_port_init</a></div><div class="ttdeci">void uart_debug_port_init(void)</div><div class="ttdoc">配置串口打印调试日志的端口</div><div class="ttdef"><b>Definition:</b> <a href="dev__uart_8c_source.html#l00090">dev_uart.c:90</a></div></div>
<div class="ttc" id="apower__manager_8c_html_a0607f7307b006db734b10c8b94bb909e"><div class="ttname"><a href="power__manager_8c.html#a0607f7307b006db734b10c8b94bb909e">sleep_resume_restore</a></div><div class="ttdeci">static void sleep_resume_restore(void)</div><div class="ttdoc">退出睡眠模式后的环境恢复</div><div class="ttdef"><b>Definition:</b> <a href="power__manager_8c_source.html#l00160">power_manager.c:160</a></div></div>
<div class="ttc" id="apower__manager_8c_html_a07250972b4737e676c66368d6b55a53f"><div class="ttname"><a href="power__manager_8c.html#a07250972b4737e676c66368d6b55a53f">pm_register</a></div><div class="ttdeci">void pm_register(pm_mode_t mode, void(*request_cb)(void), void(*resume_cb)(void))</div><div class="ttdoc">注册电源模式变化时的回调函数</div><div class="ttdef"><b>Definition:</b> <a href="power__manager_8c_source.html#l00097">power_manager.c:97</a></div></div>
<div class="ttc" id="apower__manager_8c_html_a3c4c6eea77c2517d9b66ac4f6d335d71"><div class="ttname"><a href="power__manager_8c.html#a3c4c6eea77c2517d9b66ac4f6d335d71">sleep_request_cb</a></div><div class="ttdeci">static void(*volatile sleep_request_cb)(void)</div><div class="ttdef"><b>Definition:</b> <a href="power__manager_8c_source.html#l00056">power_manager.c:56</a></div></div>
<div class="ttc" id="apower__manager_8c_html_aa125d952f6750a2c86b46ecfc611b399"><div class="ttname"><a href="power__manager_8c.html#aa125d952f6750a2c86b46ecfc611b399">pm_request</a></div><div class="ttdeci">void pm_request(pm_mode_t mode)</div><div class="ttdoc">请求进入某种电源模式</div><div class="ttdef"><b>Definition:</b> <a href="power__manager_8c_source.html#l00067">power_manager.c:67</a></div></div>
<div class="ttc" id="apower__manager_8c_html_ab9c5028de96a56cb56cd352d70cf1b87"><div class="ttname"><a href="power__manager_8c.html#ab9c5028de96a56cb56cd352d70cf1b87">sleep_request_clean</a></div><div class="ttdeci">static void sleep_request_clean(void)</div><div class="ttdoc">进入睡眠模式前的环境清理</div><div class="ttdef"><b>Definition:</b> <a href="power__manager_8c_source.html#l00121">power_manager.c:121</a></div></div>
<div class="ttc" id="apower__manager_8c_html_abbef8fc57314a19ea86ee1b3f1613a49"><div class="ttname"><a href="power__manager_8c.html#abbef8fc57314a19ea86ee1b3f1613a49">sleep_resume_cb</a></div><div class="ttdeci">static void(*volatile sleep_resume_cb)(void)</div><div class="ttdef"><b>Definition:</b> <a href="power__manager_8c_source.html#l00057">power_manager.c:57</a></div></div>
<div class="ttc" id="apower__manager_8h_html"><div class="ttname"><a href="power__manager_8h.html">power_manager.h</a></div></div>
<div class="ttc" id="apower__manager_8h_html_ad68f0f1a7d5e0cc311f261c21716f8c1"><div class="ttname"><a href="power__manager_8h.html#ad68f0f1a7d5e0cc311f261c21716f8c1">pm_mode_t</a></div><div class="ttdeci">pm_mode_t</div><div class="ttdoc">电源模式</div><div class="ttdef"><b>Definition:</b> <a href="power__manager_8h_source.html#l00028">power_manager.h:29</a></div></div>
<div class="ttc" id="apower__manager_8h_html_ad68f0f1a7d5e0cc311f261c21716f8c1a0558d994d2c989e32c28ba7be299c026"><div class="ttname"><a href="power__manager_8h.html#ad68f0f1a7d5e0cc311f261c21716f8c1a0558d994d2c989e32c28ba7be299c026">PM_MODE_STOP</a></div><div class="ttdeci">@ PM_MODE_STOP</div><div class="ttdoc">深度睡眠模式, 二级低功耗</div><div class="ttdef"><b>Definition:</b> <a href="power__manager_8h_source.html#l00033">power_manager.h:32</a></div></div>
<div class="ttc" id="apower__manager_8h_html_ad68f0f1a7d5e0cc311f261c21716f8c1a7f72cb1eff8d0a943b7029b3e93c4e67"><div class="ttname"><a href="power__manager_8h.html#ad68f0f1a7d5e0cc311f261c21716f8c1a7f72cb1eff8d0a943b7029b3e93c4e67">PM_MODE_SLEEP</a></div><div class="ttdeci">@ PM_MODE_SLEEP</div><div class="ttdoc">浅度睡眠模式, 一级低功耗</div><div class="ttdef"><b>Definition:</b> <a href="power__manager_8h_source.html#l00031">power_manager.h:31</a></div></div>
<div class="ttc" id="apower__manager_8h_html_ad68f0f1a7d5e0cc311f261c21716f8c1aeb339438b5c866323b92ac8f8c71564c"><div class="ttname"><a href="power__manager_8h.html#ad68f0f1a7d5e0cc311f261c21716f8c1aeb339438b5c866323b92ac8f8c71564c">PM_MODE_NORMAL</a></div><div class="ttdeci">@ PM_MODE_NORMAL</div><div class="ttdoc">正常活跃模式, 不锁功耗墙</div><div class="ttdef"><b>Definition:</b> <a href="power__manager_8h_source.html#l00030">power_manager.h:30</a></div></div>
<div class="ttc" id="astructdev__tp__t_html_a90323c876c50bbbc15dce886974a463f"><div class="ttname"><a href="structdev__tp__t.html#a90323c876c50bbbc15dce886974a463f">dev_tp_t::close_cb</a></div><div class="ttdeci">void(*const close_cb)(void)</div><div class="ttdoc">关闭触摸设备(eg: 低功耗)</div><div class="ttdef"><b>Definition:</b> <a href="dev__touch_8h_source.html#l00164">dev_touch.h:164</a></div></div>
<div class="ttc" id="aversion_8h_html"><div class="ttname"><a href="version_8h.html">version.h</a></div><div class="ttdoc">版本/目标控制</div></div>
</div><!-- fragment --></div><!-- contents -->
<!-- start footer part -->
<hr class="footer"/><address class="footer"><small>
制作者&#160;<a href="https://www.doxygen.org/index.html"><img class="footer" src="doxygen.svg" width="104" height="31" alt="doxygen"/></a> 1.9.5
</small></address>
</body>
</html>
